﻿using System;
using System.Collections.Generic;
using System.Linq;
using DataAccess.Services;

namespace BusinessLogic.Mappers.RemittanceAdvice
{
	class RemittanceAdviceMapper : MapperBase<BusinessEntity.Entities.RemittanceAdvice, DataControl.RA>, IRemittanceAdviceMapper
	{
		public RemittanceAdviceMapper(IServiceManager serviceManager, IMapping<BusinessEntity.Entities.RemittanceAdvice, DataControl.RA> mapping, IGatewayBase<DataControl.RA> gatewayBase)
			: base(serviceManager, gatewayBase, mapping)
		{
		}

		public IEnumerable<string> GetExistingRemittanceAdviceNumbersForClientByAccountCode(int accountCode)
		{
			return ServiceManager.RemittanceAdvice.GetRemittanceAdviceNumbersForClientByAccountCode(accountCode);
		}

		public IEnumerable<BusinessEntity.Entities.RemittanceAdvice> GetReceivedAdvices(int receiverPartyId, DateTime startDate, DateTime endDate)
		{
			return ServiceManager.RemittanceAdvice.GetReceivedAdvices(receiverPartyId, startDate, endDate).Select(dto => Mapping.ToBE(dto));
		}

		public IEnumerable<BusinessEntity.Entities.RemittanceAdvice> GetSentAdvices(int senderId, DateTime startDate, DateTime endDate)
		{
			return ServiceManager.RemittanceAdvice.GetSentAdvices(senderId, startDate, endDate).Select(dto => Mapping.ToBE(dto));
		}
	}
}